import 'dart:async';
import 'package:demo/event/event_setting.dart';
import 'package:demo/tools/tools_enum.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:get/get.dart';
import 'package:demo/views/base/base_controller.dart';
import 'package:demo/tools/tools_storage.dart';

class MineGenderController extends BaseController {
  String gender = ToolsStorage().local().gender;

  void editGender(String value) {
    gender = value;
    update();
  }

  // 提交
  Future<void> submit() async {
    // 通知
    EventSetting().handle(
      SettingModel(
        SettingType.mine,
        label: 'gender',
        value: gender,
      ),
    );
    // 提醒
    EasyLoading.showToast('修改成功');
    // 返回
    Get.back();
  }
}
